package www.rlicker.filter;

import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class FilterConfig {
	 /**
     * 配置过滤器
     * @return
     */
    @Bean
    public FilterRegistrationBean someContextFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(actionFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("actionFilter");
        return registration;
    }
    /**
     * 创建一个bean
     * @return
     */
    @Bean(name = "actionFilter")
    public Filter actionFilter() {
        return new ActionFilter();
    }
}
